home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / graphics / library / wgt51_r2.zip / WGT5 / EXAMPLES / WGT26.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-03  |  2.1 KB  |  59 lines

  1. /*
  2. ==============================================================================
  3.               WordUp Graphics Toolkit Version 5.0                     
  4.                  Demonstration Program 26                         
  5.                                           
  6.  Demonstrates use of wgtprintf command.                                      
  7.                                           
  8.  *** PROJECT ***                                                             
  9.  This program requires the file WGT5_WC.LIB to be linked.                    
  10.                                           
  11.  *** DATA FILES ***                                                          
  12.  You must have LITTLE.WFN in your executable directory.                      
  13.                                WATCOM C++ VERSION 
  14. ==============================================================================
  15. */
  16.  
  17. #include <conio.h>
  18. #include <wgt5.h>
  19.  
  20.  
  21. void main(void)
  22. {
  23.   wgtfont little;               /* Pointer to font data */
  24.   float f;                      /* Temporary variable */
  25.   short i;                        /* Loop counter */
  26.   short oldmode;                  /* Stores initial video mode */
  27.  
  28.   if ( !vgadetected () )
  29.   {
  30.     printf("Error - VGA card required for any WGT program.\n");
  31.     exit (0);
  32.   }
  33.   printf ("WGT Example #26\n\n");
  34.   printf ("A graphics version of the printf command is demonstrated.\n");
  35.   printf ("The WGTPRINTF command supports custom fonts. Press a key to end the program\n");
  36.   printf ("at any time.\n");
  37.   printf ("\n\nPress any key to continue.\n");
  38.   getch ();
  39.  
  40.  
  41.   oldmode = wgetmode ();         /* Gets the current mode */
  42.   vga256 ();                     /* Initialize graphics mode */
  43.   little = wloadfont ("little.wfn");
  44.  
  45.   wtextcolor (15);               /* Set text to white */
  46.   wtextbackground (0);           /* Background is black */
  47.   wtexttransparent (2);          /* We want to display both the foreground
  48.                     and background */
  49.   i = 0;
  50.   do
  51.   {
  52.     f = (float)i / 100;          /* Create some bogus float value */
  53.     wgtprintf (5, 50, little, "COUNT: %5i   FLOAT: %5.2f ", i, f);
  54.     i++;
  55.   } while (!kbhit ());
  56.   getch ();
  57.   wsetmode (oldmode);            /* Restores intial video mode */
  58. }
  59.